<%-- 
    Document   : trial
    Created on : Mar 30, 2014, 6:03:23 AM
    Author     : windows 7 Ult
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="sql"  uri="http://java.sun.com/jsp/jstl/sql" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
        <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
                           url="jdbc:mysql://localhost/shopping" user="root"  password="asmaaelmasry"/>
 
    <sql:query dataSource="${snapshot}" var="result">
    SELECT name from category;
    </sql:query>
 
<table border="1" width="100%">
<tr>
   <th>category name</th>
 </tr>
<c:forEach var="row" items="${result.rows}">
<tr>
   <td><c:out value="${row.name}"/></td>
 
</tr>
</c:forEach>
</table>
    </body>
</html>




